<?php
/**
 * @project     : Travel
 * @copyright   : 
 * @desc        : Thuc hien cac thao tac tren bang news
 * @coder       : Truong cong quyen
 * @createdate  : 3/11/2011
*/
class News_model extends CI_Model
{
    var $news_id=0;
    var $category_id='';
    var $user_id='';
    var $news_title_vi='';
    var $news_brief_vi='';
    var $news_content_vi='';
    var $news_title_en='';
    var $news_brief_en='';
    var $news_content_en='';
    var $news_date_create='';
    var $news_date_update='';
    var $news_image='';
    var $news_image_comment='';
    var $news_author='';
    var $news_hit_count='';
    var $news_status=1;

    
    public function __construct() {
        parent::__construct();
    }
    
    function get_all($status=1)
    {
        if($status!=-1)
        {
            $this->db->where('news_status', $status);
        }
        $query = $this->db->get('news');
        return $query->result();
        
    }
    
     function get_by_id($id)
    {
        $this->db->where('news_id', $id);
        $query = $this->db->get('news');
        return $query->row();
    }
    
    function get_limit($limit = 10, $offset = 0, $status = 1)
    {
        $this->db->order_by('news_id', 'desc');
        $this->db->where('news_status', $status);      
        $query = $this->db->get('news', $limit, $offset);        
        return $query->result();
    }
    

}